package php.code.routines;

import com.google.common.base.Joiner;
import utils.titles.Title;
import php.code.Visibility;
import php.code.instructions.VariableDeclaration;

/**
 * Created by nuno-rafael-figueiredo on 25-05-2014.
 */
public class Constructor extends Method{
    static final Title TITLE = Title.fromLowerCamel("__construct");
    private PhpClass phpClass;

    public Constructor(PhpClass phpClass, Visibility visibility, VariableDeclaration... args) {
        super(phpClass, visibility, TITLE, args);
        this.phpClass = phpClass;
    }

    public String call() {
        return "new " + phpClass.getTitle() + "(" + Joiner.on(", ").join(getVars()) + ");";
    }

}
